﻿using System;
using System.Data.Entity.ModelConfiguration.Configuration;
using ENail.Domain.Core;
using Equation.Enterprise.Framework.Domain.Model;

namespace ENail.Domain.Data.Mapping
{
    public class RegistrationMapping: EntityMappingWithTypedId<Registration, Int16>
    {
        public RegistrationMapping()
            : base("Registration")
        {
            Property(x => x.Id).HasColumnName("RegistrationId");
            Property(x => x.StatusId).HasColumnName("Status");

            HasOptional(x => x.Receipt);
            HasRequired(x => x.NailSalon).WithMany(x => x.Registrations).Map(x => x.MapKey("NailSalonId")).WillCascadeOnDelete(false);
            HasRequired(x => x.Customer).WithMany(x => x.Registrations).Map(x => x.MapKey("CustomerId")).WillCascadeOnDelete(false);
            HasMany(x => x.Assignments);
        }

    }
}
